import {createBrowserRouter} from 'react-router-dom'
import { lazy } from 'react'
// 引入图标
import { CompassOutline,HeartOutline,CouponOutline,UserOutline } from 'antd-mobile-icons'
// 引入一级路由
import Error from '../pages/404/Index'
import Map from '../pages/map/Index'
import Message from '../pages/message/Index'
import MsgList from '../pages/msglist/Index'
import Layout from '../pages/layout/Index'
import Search from '../pages/search/Index'
// 引入二级路由
let Home=lazy(()=>import('../pages/home/Index'))
let Predictcard=lazy(()=>import('../pages/predictcard/Index'))
let My=lazy(()=>import('../pages/my/Index'))
let Myheart=lazy(()=>import('../pages/myheart/Index'))

export let childroutes=[
    {
        path:'/',
        element:<Home></Home>,
        icon:<CompassOutline />,
    },
    {
        path:'/myheart',
        element:<Myheart></Myheart>,
        icon:<HeartOutline />,
    },
    {
        path:'/predictcard',
        element:<Predictcard></Predictcard>,
        icon:<CouponOutline />,
    },
    
    {
        path:'/my',
        element:<My></My>,
        icon:<UserOutline />,
    },
]
let routes=createBrowserRouter([
    {
        path:'/',
        element:<Layout></Layout>,
        children:childroutes
    },
    {
        path:'/message',
        element:<Message></Message>
    },
    {
        path:'/msgList',
        element:<MsgList></MsgList>
    },
    {
        path:'/map',
        element:<Map></Map>
    },
    {
        path:'/search',
        element:<Search></Search>
    },{
        path:'*',
        element:<Error></Error>
    }
])
export default routes